<template>
	<view class="PartnerActivities bigestBox boxSize_bb">
		<!-- <view class="flex" style="justify-content: center; margin-top: 20rpx;" v-if="cover">
			<image :src="cover" mode="" style="width: 690rpx;height: 400rpx;"></image>
		</view> -->
		<view>
			<view class="explain flex" style="margin-top: 20rpx;margin-bottom: 30rpx; font-weight: bold;">
				{{ bbsActive.title }}
			</view>
			<view class="time" style="margin-top: 24rpx;color: #979797;">发布时间：{{ bbsActive.createTime }}
			</view>
			
			<view class="flex" style="justify-content: center; margin-top: 20rpx;" v-if="cover">
				<image :src="cover" mode="" style="width: 690rpx;height: 400rpx;"></image>
			</view>
			<view class="spot" style="margin-top: 42rpx;">{{ bbsActive.content }}</view>
		</view>
	</view>
</template>

<script>
	import {
		onLoad
	} from '@dcloudio/uni-app';
	import {
		getById
	} from '../../api/bbs';
	import {
		navigateBack,
		showToast
	} from '../../utils/promise';

	export default {
		data() {
			return {
				bbsActive: {}
			};
		},
		computed: {
			cover() {
				if (Array.isArray(this.bbsActive.coverList) && this.bbsActive.coverList.length > 0) {
					return this.bbsActive.coverList[0]
				}
				return ''
			}
		},
		onLoad(options) {
			if (!options.id) {
				navigateBack()
				return
			}
			this.getbbsActive(options.id, options.type)
		},
		methods: {
			getbbsActive(id, type) {
				getById({
					id: id
				}).then((res) => {
					const {
						code,
						data,
						msg
					} = res
					if (code === 200) {
						this.bbsActive = data
					}
				}).catch((err) => {
					console.log(err)
					showToast({
						title: err.errmsg
					})
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	@import "../../static/commonStyleLess/grayBox.less";

	.PartnerActivities {
		font-family: 'PingFang SC';
		letter-spacing: -0.82rpx;
		padding-top: 10rpx;
		color: #000000;
		font-weight: 400;
		padding-left: 30rpx;
		padding-right: 30rpx;
		background-color: #FFFFFF;

		.explain {
			font-weight: 500;
			font-size: 28rpx;
		}

		.spot {
			font-weight: 500;
			font-size: 28rpx;
		}

		.time {
			font-size: 26rpx;
		}
	}
</style>